import request from '../request'
import { BASE_URL } from '../request/config'

enum roadWayApiEnum {
  tunnelQueryPage = 'baseservice/tunnel/queryPage',
  tunnelAdd = 'baseservice/tunnel/add',
  tunnelDetail = 'baseservice/tunnel/detail',
  tunnelFindDropDown = 'baseservice/tunnel/findDropDown',
  regionFindDropDown = 'baseservice/warehouseRegion/findDropDown',
  tunnelUpdate = 'baseservice/tunnel/update',
  tunnelUpdateState = 'baseservice/tunnel/updateState',
  tunnelDownloadTemplate = 'baseservice/tunnel/download/template',
  tunnelImport = 'baseservice/tunnel/import',
  tunnelExport = 'baseservice/tunnel/export',
  tunnelGenerateCode = 'baseservice/tunnel/generateCode',
}

export const tunnelQueryPage = (data: any) => request.POST<anyObject[]>({ url: roadWayApiEnum.tunnelQueryPage, data }) // 巷道列表

export const tunnelAdd = (data: any) => request.POST<string>({ url: roadWayApiEnum.tunnelAdd, data }) // 新增巷道

export const tunnelDetail = (data: any) => request.GET<anyObject>({ url: roadWayApiEnum.tunnelDetail, data }) // 查看巷道详情

export const tunnelFindDropDown = (data: any) => request.POST<dictionaryType[]>({ url: roadWayApiEnum.tunnelFindDropDown, data }) // 查询巷道下拉框

export const regionFindDropDown = (data: any) => request.GET<dictionaryType[]>({ url: roadWayApiEnum.regionFindDropDown, data }) // 查询库区下拉框

export const tunnelUpdate = (data: any) => request.POST<boolean>({ url: roadWayApiEnum.tunnelUpdate, data }) // 编辑巷道

export const tunnelUpdateState = (data: any) => request.POST<boolean>({ url: roadWayApiEnum.tunnelUpdateState, data }) // 更新巷道状态

export const tunnelDownloadTemplate = () => request.POST<string>({ url: roadWayApiEnum.tunnelDownloadTemplate, method: 'post' }) // 获取巷道导入模板

export const tunnelImport = () => BASE_URL + roadWayApiEnum.tunnelImport // 巷道文件上传地址

export const tunnelExport = (data: any) => request.POST<string>({ url: roadWayApiEnum.tunnelExport, data }) // 导出

export const tunnelGenerateCode = (data: any) => request.GET<string>({ url: roadWayApiEnum.tunnelGenerateCode, data }) // 生成代码
